package lec;

public class Equality {
	public static void main(String[] a){
		String x = "Hello";
		String y = new String("Hell") + "o";
		String z = x;
		if ( x.equals(y) )
			System.out.println(x + " and " + y + " are the same.");
		else
			System.out.println(x + " and " + y + " are not the same.");

		if ( x.equals(z) )
			System.out.println(x + " and " + z + " are the same.");
		else
			System.out.println(x + " and " + z + " are not the same.");

		if (x.hashCode() == y.hashCode())
			System.out.println(x + " and " + y + " have the same hashcode.");
		else
			System.out.println(x + " and " + y + " have different hashcodes.");

		if (x.hashCode() == z.hashCode())
			System.out.println(x + " and " + z + " have the same hashcode.");
		else
			System.out.println(x + " and " + z + " have different hashcodes.");

	}
}
